/**
 * 验证手机号码
 */
export const regularPhone = (_phone) => {
  let reg = /^[1][3, 4, 5, 6, 7, 8][0-9]{9}$/
  if (reg.test(_phone)) {
    return true;
  } else {
    return false;
  }
}
/**
 * 验证验证码
 */
export const regularAuthCode = (_authCode) => {
  let reg = /^[0-9]{4}$/;
  if (reg.test(_authCode)) {
    return true;
  } else {
    return false;
  }
}
/**
 * 验证密码
 */
export const regularPass = (_pass) => {
  let reg = /^(?!(?:\d+|[a-zA-Z]+)$)[\da-zA-Z]{6,16}$/;
  if (reg.test(_pass)) {
    return true;
  } else {
    return false;
  }
}
/**
 * 验证中文姓名
 */
export const regularName = (_name) => {
  let reg = /^[\u4E00-\u9FA5A-Za-z]+$/;
  if (reg.test(_name)) {
    return true;
  } else {
    return false;
  }
}
/**
 * 匹配Email地址
 */
export const regularEmail = (_str) => {
  if (_str == null || _str == "") return false
  var result = _str.match(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/)
  if (result == null) return false
  return true
}
/**
 * 判断是否为正整数(只能输入数字[0-9])
 */
export const regularInteger = (_num) => {
  let reg = /(^[0-9]\d*$)/
  if (reg.test(_num)) {
    return true
  } else {
    return false
  }
}
/**
 * 验证是否空对象
 */
export const regularObj = function (_obj) {
  for (let k in _obj) {
    return false;
  };
  return true;
};

/**
 * 验证是否为空
 */
export const regularTrim = (_str) => {
  return _str.trim() == ''
}
